
import axios from 'axios';
//设置默认状态
function sessionStoragePut(key,value){
    //将对象转化成json字符串，存入sessionStorage
    sessionStorage.setItem(key, JSON.stringify(value));
}
function sessionStorageGet(key,isRemove){
    //从sessionStorage中取出json字符串，然后将json字符串转化成对象,并返回.
    var result=JSON.parse(sessionStorage.getItem(key));
    if(isRemove){
        sessionStorage.removeItem(key);
    }
    return result;
}
let user={
  userId:'',
  openid:'',
  mobile:''
}
let myuser;
// 刷新的时候 如果缓存中有用户信息 覆盖上面的
if(!!sessionStorage.getItem('user')) {
  // myuser = sessionStorageGet('user');
} else {
  // myuser = user;
  // sessionStoragePut('user',user);
}
export const initUser = user;

// import { Loading } from 'element-ui';

// export const starLoad = (option = {}) => {
//   let arg = Object.assign({},{spinner: 'el-icon-loading', background: 'rgba(255, 255, 255, 0.95)'},option);
//   return Loading.service(arg)
// }

// export const starLoad = Loading.service({spinner: 'el-icon-loading', background: 'rgba(255, 255, 255, 0.95)'})

export const axios_ = axios.create({
  // https://bird.ioliu.cn/v2?url=
  // baseURL:'http://192.168.105.181:10011/',
  baseURL:'https://bird.ioliu.cn/v2?url=https://www.toohui.com/',
  // onUploadProgress: () => {
  //   starLoad()
  // },
  // onDownloadProgress: function(progressEvent){
  //   starLoad().close()
  //  },
})
